<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="/lib/vue-2.4.0.js"></script>
</head>

<body>
  <div id="app">
    <my-com></my-com>
    <my-com></my-com>
    <my-com></my-com>
    <my-com></my-com>
  </div>
</body>
<template id="myTemp">
  <div>
    <button @click="addCount">点我</button>
    <span>当前数量：{{count}}</span>
  </div>
</template>
<script>
  let myCom = Vue.extend({
    template: '#myTemp',
    data() {
      return {
        count: 0
      }
    },
    methods: {
      addCount() {
        this.count++
      }
    }
  })
  let app = new Vue({
    el: '#app',
    components: {
      myCom
    }
  })
</script>

</html>